-- @owner: danny20001210
-- @date: 2025-5-15
-- @testpoint:验证xmltype模块结合不同数据类型使用正确，success，部分用例合理报错
@conn PrimaryDbAmode;
drop table if exists test_xmltype_1087936;
drop table if exists test_xmltype_1087935;
drop table if exists test_xmltype_1087934;
drop table if exists test_xmltype_1087933;
drop table if exists test_xmltype_1087932;

create table test_xmltype_1087936(
ID int,
data xmltype
);
insert into test_xmltype_1087936 values(1,date'2022-08-08');
insert into test_xmltype_1087936 values(1,interval'2 hour');
insert into test_xmltype_1087936 values(1,time'22:15:58');
--转换为xml类型
insert into test_xmltype_1087936 values(1,(select xmlparse(content date'2022-08-08')));
insert into test_xmltype_1087936 values(1,(select xmlparse(content interval'2 hour')));
insert into test_xmltype_1087936 values(1,(select xmlparse(content time'22:15:58')));
--查表
select *from test_xmltype_1087936;

create table test_xmltype_1087935(
ID int,
data xmltype
);

insert into test_xmltype_1087935 values(1,78::money);
insert into test_xmltype_1087935 values(1,1619198::bit(10));
--转换为xml在插入数据
insert into test_xmltype_1087935 values(1,(select xmlparse(content 78::money)));
insert into test_xmltype_1087935 values(1,(select xmlparse(content 1619198::bit(10))));
select *from test_xmltype_1087935;

create table test_xmltype_1087934(i int, d xmltype);
insert into test_xmltype_1087934 values(1,'sdn'::varchar(30));
insert into test_xmltype_1087934 values(1,(select xmlparse(content 'abc'::varchar)));
select * from test_xmltype_1087934;

create table test_xmltype_1087933(i int, d xmltype);

---1.插入缺少最左尖括号数据(无对称<>)
Insert into test_xmltype_1087933 values(2,'b/>');
Insert into test_xmltype_1087933 values(3,'xml version="1.0"?><person><one></one></person>');
--查看表
select * from test_xmltype_1087933;
---插入缺少除最左尖括号的其他符号
---2.插入缺少最左尖括号数据(有对称<>)
insert into test_xmltype_1087933 values(1,'a>testAA</a><b></b>');
--3.缺少右边尖括号
Insert into test_xmltype_1087933 values(2,'<b/');
--4.缺少？
Insert into test_xmltype_1087933 values(3,'<xml version="1.0"?><person><one></one></person>');
--5.缺少/
Insert into test_xmltype_1087933 values(4,'<test>abc<test><name>foo</name>');
--查看表
select * from test_xmltype_1087933;


create table test_xmltype_1087932(i int, d xmltype);
---1.插入数据
insert into test_xmltype_1087932 values(1,null);
insert into test_xmltype_1087932 values(2,'');
insert into test_xmltype_1087932 values(3,'<a>testAA</a><b></b>');
insert into test_xmltype_1087932 values(4,'<a> </a>');
Insert into test_xmltype_1087932 values(5,'<b/>');
Insert into test_xmltype_1087932 values(6,'<?xml version="1.0"?><person><one></one></person>');
Insert into test_xmltype_1087932 values(7,'<test>abc</test><name>foo</name>');
--查看表
select * from test_xmltype_1087932;

drop table if exists test_xmltype_1087936;
drop table if exists test_xmltype_1087935;
drop table if exists test_xmltype_1087934;
drop table if exists test_xmltype_1087933;
drop table if exists test_xmltype_1087932;